<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Easy
  </div>
  <div>
   <h1 class="question_title">
    189. Rotate Array
   </h1>
   <p>
    Given an array, rotate the array to the right by
    <em>
     k
    </em>
    steps, where&nbsp;
    <em>
     k
    </em>
    &nbsp;is non-negative.
   </p>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> <code>[1,2,3,4,5,6,7]</code> and <em>k</em> = 3
<strong>Output:</strong> <code>[5,6,7,1,2,3,4]</code>
<strong>Explanation:</strong>
rotate 1 steps to the right: <code>[7,1,2,3,4,5,6]</code>
rotate 2 steps to the right: <code>[6,7,1,2,3,4,5]
</code>rotate 3 steps to the right: <code>[5,6,7,1,2,3,4]</code>
</pre>
   <p>
    <strong>
     Example 2:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> <code>[-1,-100,3,99]</code> and <em>k</em> = 2
<strong>Output:</strong> [3,99,-1,-100]
<strong>Explanation:</strong> 
rotate 1 steps to the right: [99,-1,-100,3]
rotate 2 steps to the right: [3,99,-1,-100]
</pre>
   <p>
    <strong>
     Note:
    </strong>
   </p>
   <ul>
    <li>
     Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem.
    </li>
    <li>
     Could you do it in-place with O(1) extra space?
    </li>
   </ul>
  </div>
  <div>
   <h1 class="question_title">
    189. 旋转数组
   </h1>
   <p>
    给定一个数组，将数组中的元素向右移动&nbsp;
    <em>
     k&nbsp;
    </em>
    个位置，其中&nbsp;
    <em>
     k&nbsp;
    </em>
    是非负数。
   </p>
   <p>
    <strong>
     示例 1:
    </strong>
   </p>
   <pre><strong>输入:</strong> <code>[1,2,3,4,5,6,7]</code> 和 <em>k</em> = 3
<strong>输出:</strong> <code>[5,6,7,1,2,3,4]</code>
<strong>解释:</strong>
向右旋转 1 步: <code>[7,1,2,3,4,5,6]</code>
向右旋转 2 步: <code>[6,7,1,2,3,4,5]
</code>向右旋转 3 步: <code>[5,6,7,1,2,3,4]</code>
</pre>
   <p>
    <strong>
     示例&nbsp;2:
    </strong>
   </p>
   <pre><strong>输入:</strong> <code>[-1,-100,3,99]</code> 和 <em>k</em> = 2
<strong>输出:</strong> [3,99,-1,-100]
<strong>解释:</strong> 
向右旋转 1 步: [99,-1,-100,3]
向右旋转 2 步: [3,99,-1,-100]</pre>
   <p>
    <strong>
     说明:
    </strong>
   </p>
   <ul>
    <li>
     尽可能想出更多的解决方案，至少有三种不同的方法可以解决这个问题。
    </li>
    <li>
     要求使用空间复杂度为&nbsp;O(1) 的原地算法。
    </li>
   </ul>
  </div>
 </body>
</html>